#include <gtest/gtest.h>

bool IsSumNegative( int a, int b ,int c)
{
    return (a+b+c) > 0?true:false;
}

TEST(SimpleTest , PredTest)
{
    //ASSERT_PRED3(IsSumNegative,1,2,-3);
    ASSERT_PRED3(IsSumNegative,1,2,3);

}

int TriBoolFunc(int a ,int b)
{
    if( a > b ){
        return 1;
    }
    else if ( a == b){
        return 0;
    } 
    else{
        return -1;
    }
}



::testing::AssertionResult TriBoolFuncAssert( int a,int b)
{
    if(TriBoolFunc(a,b) > 0)
    {
        return ::testing::AssertionSuccess();
    }
    else if( TriBoolFunc(a,b) == 0 ){
        return ::testing::AssertionSuccess();
    }
    else{
        return ::testing::AssertionFailure() << "error info = " << a << " < " << b;
    }
}

TEST(SimpleTest , AssertInfo)
{
    //ASSERT_TRUE(TriBoolFuncAssert(1,2));
    ASSERT_TRUE(TriBoolFuncAssert(1,1));
}

int testzero( int a)
{
    return a == 0 ;
}

::testing::AssertionResult AssertTestZero(const char* expr,int a)
{
    if(testzero(a)){
        return ::testing::AssertionSuccess();
    }
    else{
        return ::testing::AssertionFailure() << "error info = " << a<< " < 0";
    }

}

TEST(SimpleTest,PredFormater)
{
    int a= -1;
    EXPECT_PRED_FORMAT1( AssertTestZero , a);
}

int main(int argc,char* argv[])
{
    ::testing::InitGoogleTest(&argc,argv);
    return RUN_ALL_TESTS();
}